package com.nmsl.system.service.impl;

import java.util.List;

import com.nmsl.system.mapper.JinEmployeeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.nmsl.system.mapper.SuppliersMapper;
import com.nmsl.system.domain.Suppliers;
import com.nmsl.system.service.ISuppliersService;

/**
 * 供应商信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-02-17
 */
@Service
public class SuppliersServiceImpl implements ISuppliersService 
{
    @Autowired
    private SuppliersMapper suppliersMapper;
    @Autowired
    private JinEmployeeMapper jinEmployeeMapper;

    /**
     * 查询供应商信息
     * 
     * @param supplierId 供应商信息主键
     * @return 供应商信息
     */
    @Override
    public Suppliers selectSuppliersBySupplierId(Long supplierId)
    {
        return suppliersMapper.selectSuppliersBySupplierId(supplierId);
    }

    /**
     * 查询供应商信息列表
     * 
     * @param suppliers 供应商信息
     * @return 供应商信息
     */
    @Override
    public List<Suppliers> selectSuppliersList(Suppliers suppliers)
    {
        List<Suppliers> suppliersList = suppliersMapper.selectSuppliersList(suppliers);
        for (Suppliers item : suppliersList) {
            item.setCreatorName(jinEmployeeMapper.selectJinEmployeeById(item.getCreatorId()).getName());
        }
        return suppliersList;
    }

    /**
     * 新增供应商信息
     * @param suppliers 供应商信息
     * @return 结果
     */
    @Override
    public int insertSuppliers(Suppliers suppliers)
    {
        return suppliersMapper.insertSuppliers(suppliers);
    }

    /**
     * 修改供应商信息
     * 
     * @param suppliers 供应商信息
     * @return 结果
     */
    @Override
    public int updateSuppliers(Suppliers suppliers)
    {
        return suppliersMapper.updateSuppliers(suppliers);
    }

    /**
     * 批量删除供应商信息
     * 
     * @param supplierIds 需要删除的供应商信息主键
     * @return 结果
     */
    @Override
    public int deleteSuppliersBySupplierIds(Long[] supplierIds)
    {
        return suppliersMapper.deleteSuppliersBySupplierIds(supplierIds);
    }

    /**
     * 删除供应商信息信息
     * 
     * @param supplierId 供应商信息主键
     * @return 结果
     */
    @Override
    public int deleteSuppliersBySupplierId(Long supplierId)
    {
        return suppliersMapper.deleteSuppliersBySupplierId(supplierId);
    }
}
